//
//  ServerNetworkCenter.h
//  Karaoke
//
//  Created by Ka Leung Ke on 11-10-17.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AsyncSocket.h"

// static const int    rtHallBound = 90;
// static const int    rtYeWuJingLiBound = 91;
// static const int    rtDJManagerBound = 92;
// static const int    rtZiKeBound = 93;
// static const int    rtDuChaBound = 94;
// static const int    rtManagerBound = 95;
// static const int    rtLeadRoom = 96;
// static const int    rtBound = 100;              // 绑定
// static const int    rtClientRegist = 101;       // 客户端向服务端登记
// static const int    rtClerkName = 102;          // 根据IC卡号或密码请求服务器返回员工姓名
// static const int    rtFoodType = 103;           // 请求服务端返回酒水类别数据
// static const int    rtFoodList = 104;           // 请求服务端返回酒水数据
// static const int    rtSelectFood = 105;         // 点酒水命令
// static const int    rtAddInfoOfFood = 106;      //服务端返回酒水附加项目选项
// static const int    rtPackChild = 107;          //服务端返回套餐子项数据
// static const int    rtAutoFreeFood = 108;       //服务端返回自动赠送的酒水数据
// static const int    rtBillInfo = 109;           // 请求服务端返回账单信息
// static const int    rtOpenRoom = 110;           // 向服务端发出开房台的命令
// static const int    rtPleaseSettle = 111;       // 向服务端发出申请结账的命令
// static const int    rtClearRoom = 112;          // 向服务端发出置可用房的命令
// static const int    rtConfirmDiscount = 113;    // 向服务端发出执行经理折扣的命令
// static const int    rtConfirmInputFood = 114;   // 向服务端发出确认落单的命令
// static const int    rtConfirmFreeFood = 115;    // 向服务端发出确认赠送的命令
// static const int    rtServiceList = 116;        // 请求服务端返回可供选择服务的列表
// static const int    ftSelectService = 117;      // 请求服务
// static const int    rtRoomStates = 118;         // 房台状态列表
// static const int    rtRoomStateAndInfo = 119;   // 返回选中房台的状态，如空房、已预订、消费中等

@interface ServerNetworkCenter : NSObject
{
    AsyncSocket    * mainSocket;
    BOOL             isConnect;
    NSMutableData  * receiveData;
    NSStringEncoding encGBK;
    int              dataOffset;
}

@property BOOL isConnect;
+ (ServerNetworkCenter *) sharedInstance;

- (void) disconnectToServer;
- (void) initConnect;
- (void) sentMsg:(NSString *)tempMsg;
- (void) sentMsgAskForUpdate;
- (void) sentMsgAskForReg:(NSString *)tempCode;
- (BOOL) checkIfVaildMsg:(NSData *)tempData;
- (void) sendMsg:(int)cmd:(NSArray *)para;
- (void) sentMsg:(int)cmd:(NSString *)para, ...;
- (BOOL) getConnected;

- (NSString *) getBoundCode;
- (void) updateBoundCode:(NSString *)codeString;
@end
